﻿namespace Common.Identity;

public class IdentityContext
{
    private static readonly AsyncLocal<UserInfo> _userInfo = new();

    public static UserInfo? Current => _userInfo.Value;

    public static void Set(UserInfo userInfo)
    {
        _userInfo.Value = userInfo;
    }

    public static void Release()
    {
        _userInfo.Value = null!;
    }
}